<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
</h:head>

<h:body>
	<ui:composition template="/WEB-INF/templates/homeTemplate.xhtml">

		<ui:define name="content">
			<h4>
				#{msg.createPatientHeader}
			</h4>
			<h:form>
				<h:panelGrid columns="3" border="0"
					title="Patient Test Record Entry" frame="above"
					columnClasses="lableCol,componentCol,validationMsgCol">

					<h:outputLabel value="Patient Name : " />
					<h:panelGroup>
						<h:inputText id="firstName" value="#{pte.patient.firstName}"
							required="true">
							<f:validateLength minimum="2" maximum="150" />
						</h:inputText>
						<h:inputText value="#{pte.patient.lastName}" />
					</h:panelGroup>
					<h:message for="firstName" />

					<h:outputLabel value="Gender : " />
					<h:panelGroup>
						<h:selectOneRadio id="gender" value="#{pte.patient.gender}" required="true"
						requiredMessage="Please select Gender">
							<f:selectItem itemLabel="Male" itemValue="m" />
							<f:selectItem itemLabel="Female" itemValue="f" />
						</h:selectOneRadio>
					</h:panelGroup>
					<h:message for="gender" />

					<h:outputLabel id="age" value="Age : " />
					<h:inputText value="#{pte.patient.age}">
						<f:validateLongRange minimum="0" maximum="120"/>
					</h:inputText>
					<h:message for="age" />

					<h:outputText value="Contact Details" style="font-weight:bold" />
					<h:outputText value="" />
					<h:outputText value="" />

					<h:outputLabel value="Building : " />
					<h:inputText id="building" value="#{pte.patient.contact.building}"/>
					<h:message for="building" />

					<h:outputLabel value="Street : " />
					<h:inputText id="street" value="#{pte.patient.contact.street}"/>
					<h:message for="street" />

					<h:outputLabel value="City : " />
					<h:inputText id="city"/>
					<h:message for="city" />

					<h:outputLabel value="State : " />
					<h:inputText id="state" />
					<h:message for="state" />

					<h:outputLabel value="Pincode : " />
					<h:inputText id="pincode" maxlength="6" value="#{pte.patient.contact.pincode}"/>
					<h:message for="pincode" />

					<h:outputLabel value="Mobile Number : " />
					<h:inputText id="mobile" maxlength="10" value="#{pte.patient.contact.mobileNumber}"/>
					<h:message for="mobile" />
					

					<h:outputText value="" />
					<h:commandButton value="Save" action="#{pte.savePatient()}" />
					<h:outputText value="" />
				</h:panelGrid>
			</h:form>
		</ui:define>

	</ui:composition>
</h:body>

</html>